<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>example</title>
</head>

<body id="app">
  <h2 style="color:red" id="test">我是标题1</h2>
  <h2 style="color:green">我是标题2</h2>
  <h2 class="no-print">我会被忽略</h2>
  <button id="button1">打印全部</button>
  <button id="button2">打印局部</button>
</body>
<script src=" ../dist/index.js"></script>
<script>
  var button1 = document.getElementById('button1');
  var button2 = document.getElementById('button2');
  button1.onclick = () => {
    $Print('#app')
  }
  button2.onclick = () => {
    $Print('#test')
  }
</script>

</html>